﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using EFramework.Web.Configuration;

namespace  RzCorportativo.Views.Farmacia
{
    public partial class Atendimento : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Cpf.Attributes.Add("url", this.ResolveUrl("~/Views/Farmacia/Atendimento.aspx/GetPaciente"));
            this.TipoMedicamento.Attributes.Add("url", this.ResolveUrl("~/Views/Farmacia/Medicamento.aspx/ListarTipo"));
        }
        
        [WebMethod]
        public static object GetPaciente(string termo)
        {
            var pacientes = RzCorportativo.Lib.Usuario.Listar(new RzCorportativo.Lib.Usuario() { Cpf = MaskConfiguration.RemoveMask(termo, "cpfKeyDel") });
            return pacientes.Select(s => new { value = s.Cpf, label = s.Cpf, Cpf = s.Cpf, Nome = s.Nome, PacienteId = s.UsuarioId }).ToList();
        }
    }
}